import {getTeacherList, getParentList, getStudentDetail, getEchartsData, likeGo} from '@/api/studentSportApi'
const studentSport = {
    namespaced: true,
    state: {
        classId: localStorage.classId ? localStorage.classId : "",
        studentId: localStorage.studentId ? localStorage.studentId : ""
    },
    getters: {
    },
    mutations: {
        setClassId (state, id) {
            state.classId = id
            localStorage.classId = id
        },
        setStudentId (state, id) {
            state.studentId = id
            localStorage.studentId = id
        }
    },
    actions: {
        // 
        GetTeacherList ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getTeacherList(params).then(res => {
                    resolve(res)
                })
            })
        },
        GetParentList ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getParentList(params).then(res => {
                    resolve(res)
                })
            })
        },
        GetStudentDetail ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getStudentDetail(params).then(res => {
                    resolve(res)
                })
            })
        },
        GetEchartsData ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                getEchartsData(params).then(res => {
                    resolve(res)
                })
            })
        },
        LikeGo ({state, commit, dispatch}, params) {
            return new Promise((resolve, reject) => {
                likeGo(params).then(res => {
                    resolve(res)
                })
            })
        }
    }
}
export default studentSport
